package com.tanhua.sso.config;

import com.aliyun.oss.OSSClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * @Description AUTO
 * @ClassName AliyunOSSConfig
 * @Author ZhengXinjie
 * @date 2021.02.20 09:47
 */
@Configuration
@ConfigurationProperties(prefix = "aliyun.oss")
@PropertySource("classpath:aliyun.properties")
@Data
public class AliyunOSSConfig {
    private String endpoint;
    private String accessKeyId;
    private String accessKeySecret;
    private String bucketName;
    private String urlPrefix;


    @Bean
    public OSSClient getClient(){
        return new OSSClient(endpoint, accessKeyId, accessKeySecret);
    }
}
